package com.mapper;

import com.entity.Resource;
import com.vo.ResourceAndPageInfoVO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 陈忠杰
 * @Date: 2021/06/30/下午6:11
 * @Description:关于作者资源的Mapper接口
 */

public interface ResourceMapper {

    /**
    * @Description: 根据userId和pageNo查找Resource实体类对象的list
    * @Param: [userId：用户id, pageNo：当前页数]
    * @return: java.util.List<com.entity.Resource>
    * @Author: 陈忠杰
    * @Date: 2021/6/30
    */
    List<Resource> selResourceByUserIdAndPageNo(@Param("userid")int userId);

    /**
    * @Description: 向t_resource表插入数据
    * @Param: [title, path, original_name, file_size, file_type, cost_type, cost_number, userId, chapter_id, status]
    * @return: int
    * @Author: 陈忠杰
    * @Date: 2021/7/2
    */
    int insResource(@Param("title") String title,@Param("path") String path, @Param("original_name")String original_name,@Param("file_size") long file_size, @Param("file_type")String file_type,@Param("create_date") Date date, @Param("cost_type")int cost_type,@Param("cost_number") int cost_number,@Param("user_id") int user_id, @Param("chapter_id")int chapter_id,@Param("status") int status);

    int updResource(@Param("title") String title,@Param("path") String path, @Param("original_name")String original_name,@Param("file_size") long file_size, @Param("file_type")String file_type,@Param("create_date") Date date, @Param("cost_type")int cost_type,@Param("cost_number") int cost_number,@Param("user_id") int user_id, @Param("chapter_id")int chapter_id,@Param("status") int status,@Param("id") int id);

    int delResource(@Param("id")int id);

    int updStatus(@Param("id")int id,@Param("status") int status);

    List<Resource> selResourceByInfo(ResourceAndPageInfoVO resourceAndPageInfoVO);

    Resource selResourceById(int id);
}
